/* PANEO JavaScript */
function backcolorresize(){
    var ww = $(window).width();
    var pl = parseInt($('div#contents').css('padding-left'));
    var ww_diff = ww - ${PANEO_WIDTH};

    //backcolor xx 
    $('div.backcolor').each( function() {
        $('.color',this).height($(this).parent('section').height());
        $('.color',this).width(ww);
        $('.color',this).css({left:0});
        if( ww > ( ${PANEO_WIDTH} ) ){
            $(this).css({left:(ww_diff/2)*-1});
            $(this).width(ww);
        }else{
            $('.color',this).css({left:pl*-1});
            $(this).css({left:0});
            $(this).width(ww-(pl*2));
        }
        $(this).find('div.cover').each( function(){
            if( ww > ( ${PANEO_WIDTH} ) ){
                    var diff = 0;
                    if( ( ww - ${PANEO_WIDTH} ) > 200)
                    {
                            diff = 200;
                            $(this).css({left:(ww_diff/2)-(diff/2)});
                            $(this).width(${PANEO_WIDTH}+diff);
                    }else{
                            $(this).css({left:0});
                            $(this).width(ww);
                    }
            }else{
                    $(this).css({left:(pl/2)*-1});
                    $(this).width(ww-pl);
            }
            $('img',this).css({visibility:'visible'});
        });
    });
    //backcolor xx 

    //square
    $('div.square').each( function() {
            var w = $(this).parent().width();
            $(this).width(w);
            $(this).height(w);
            $(this).css({visibility:'visible'});
        }
    );
}

jQuery.event.add(window, "load", function(){
    backcolorresize();
});

$( window ).resize(function(){
    backcolorresize();
});

/* fit text */
$(function(){
    $("h1").fitText(1.2,{ minFontSize: '20px', maxFontSize: '41px' });
    $("h2").fitText(1.2,{ minFontSize: '20px', maxFontSize: '34px' });
    $("h3").fitText(1.2,{ minFontSize: '20px', maxFontSize: '27px' });
});



